    <?php defined('BASEPATH') OR exit('No direct script access allowed'); ?><!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico" >
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/public/js/html5shiv.js"></script>
    <script type="text/javascript" src="/public/js/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/Hui-iconfont/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/css/style.css" />
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <script type="text/javascript" src="/public/plugins/My97DatePicker/WdatePicker.js"></script>
    
    <!--[if IE 6]>
    <script type="text/javascript" src="/public/js/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>快方管理后台</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <style type="text/css">

    </style>
</head>
<body class="big-page">
<form id="form">
<table class="table table-border" id="mytable">
    <input type="hidden" name="YID" value="<?=$yid ?>">
    <!-- <tr>
        <td colspan="2" style="text-align: right;"><input type="button" name="add" class="btn btn-primary radius" value="添加" onclick="addRow()"></td>
    </tr> -->
    <?php if($res){ ?>
    <?php foreach ($res as $key => $value) {?>
        <tr id='row'>
            <td colspan="2" style="text-align: left;">配送时间：
                <input class="Wdate" type="text" size="10" name="BTM[]"onClick="WdatePicker({el:this,dateFmt:'HH:mm:ss'})" value="<?=$value['BTM'] ?>">——<input class="Wdate" type="text" size="10" name="ETM[]" onClick="WdatePicker({el:this,dateFmt:'HH:mm:ss'})" value="<?=$value['ETM'] ?>">
                <?php foreach ($data as $k => $v) {?>
                <input type="checkbox" name="PTID[]" value="<?=$v['ID']?>" <?php 
                        if(in_array($v['ID'],explode(',',$value['PTID'])))
                        echo checked; 
                      ?>><?=$v['TL']?>
                <?php }?>
                 
            </td>
        </tr>
    <?php } ?>
    <?php }else {?>
        <tr id='row'>
            <td colspan="2" style="text-align: left;">配送时间：
                <input class="Wdate" type="text" size="10" name="BTM[]"onClick="WdatePicker({el:this,dateFmt:'HH:mm:ss'})" value="<?=$value['BTM'] ?>">——<input class="Wdate" type="text" size="10" name="ETM[]" onClick="WdatePicker({el:this,dateFmt:'HH:mm:ss'})" value="<?=$value['ETM'] ?>">
                <?php foreach ($data as $k => $v) {?>
                <input type="checkbox" name="PTID[]" value="<?=$v['ID']?>" <?php 
                        if(in_array($v['ID'],explode(',',$value['PTID'])))
                        echo checked; 
                      ?>><?=$v['TL']?>
                <?php }?>
                <!-- <input type="button" value="删除" onclick="deleteRow(this)">  -->
            </td>
        </tr>
    <?php }?>

    <!-- <tr id="row">
        <td colspan="2" style="text-align: left;">
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="Wdate" type="text" size="10" name="BTM"onClick="WdatePicker({el:this,dateFmt:'HH:mm:ss'})">——<input class="Wdate" type="text" size="10" name="ETM" onClick="WdatePicker({el:this,dateFmt:'HH:mm:ss'})">
            <input type="button" value="删除" onclick="deleteRow(this)">
        </td>
    </tr> -->
    <!-- <tr>
        <td colspan="2" style="text-align: center;">
            <input type="button" name="update" class="btn btn-primary radius" value="保存">
            &emsp;
            <input type="button" name="cancel" class="btn radius" value="取消">
        </td>
    </tr> -->
</table>
</form>
<script src="http://webapi.amap.com/maps?v=1.3&key=30d49820c57fa434f5a8783322b817a8&plugin=AMap.PolyEditor,AMap.CircleEditor"></script>

<script type="text/javascript" src="/public/js/jquery.min.js"></script>
<script type="text/javascript" src="/public/plugins/layer/layer.js"></script>
<script type="text/javascript" src="/public/plugins/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/public/plugins/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="/public/plugins/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
<script type="text/javascript">
function deleteRow(r)
{
    var i=r.parentNode.parentNode.rowIndex;
    document.getElementById('mytable').deleteRow(i);
}
function addRow()
{
    var table = document.getElementById("mytable");
    var tr = table.insertRow(2);
    var td = tr.insertCell(-1);
    td.innerHTML = document.getElementById("row").innerHTML;
}
$("input[name='cancel']").bind("click", function(){
    parent.layer.closeAll();
})
$("input[name='update']").bind("click", function(){
    $.ajax({
        url: '/Plantforms/updatePeisong',
        type: "POST",
        dataType: "json",
        data: $("#form").serialize(),
        success:function(res){
            if(res.status == "success"){
                alert("修改成功");
                parent.location.reload();
            }else{
                alert(res.info);
            }

        }
    }); 
    return true; 
    
})
// $("input[name='cancel_time']").bind("click", function(){
//     parent.layer.closeAll();
// })
// $("input[name='update_time']").bind("click", function(){
//     $.ajax({
//         url: '/Plantforms/updatePeisongtime',
//         type: "POST",
//         dataType: "json",
//         data: $("#form2").serialize(),
//         success:function(res){
//             if(res.status == "success"){
//                 alert("修改配送时间成功");
//                 parent.location.reload();
//             }else{
//                 alert(res.info);
//             }

//         }
//     });
//     return true;
// })
</script>
</body>
</html>
